<template>
  <div class='list bc-white'>
    <ul>
      <li v-for="(item,index) in formatListData" class="active clearB" :key="index" @click="showDetail(item,index)">
        <p class="title">{{item.title}}  <img :src="item.collect?img_collected:img_active" alt="" class="active fr" @click.stop="setCollect(item)"></p>
        <p><span>联系人：{{item.name||'匿名'}} <a class="color-green" @click.stop="telTo(item.tel)">{{item.tel}}</a> </span> </p>
        <p><span>地点：{{item.location||'暂无'}}</span></p>
        <p class="pr"><span>发布时间：{{item.pubtime}}</span> <span class="pay pa">{{item.pay>0?('￥'+item.pay+'元/月'):"保密"}}</span></p>
        
        
        <p class="request clearB" v-show="!item.isShow"><span class="fl">要求：</span><span class="white-space ">{{item.content||'暂无'}}</span></p>

        <p class="request clearB" v-show="item.isShow"><span class="fl">要求：</span><span>{{item.content||'暂无'}}</span></p>
        <p class="request clearB more-info"><span class="fl">描述：</span><span>{{item.describe||'暂无'}}</span></p>
        <p class="arrow"><img :src="item.isShow?arrow_top:arrow_bottom" alt=""></p>
      </li>
    </ul>
    <p class="no-data" v-if="formatListData.length===0">暂时没有数据哦~</p>
  </div>
</template>
<script>
export default {
  props:['listData','routerDetail'],
  components: {},
  name: "",
  data() {
    return {
      img_active:require('../../../../../assets/images/home/icon-collected.png'),
      img_collected:require('../../../../../assets/images/home/icon-collected-s.png'),
      arrow_top:require('../../../../../assets/images/home/arrow-top.png'),
      arrow_bottom:require('../../../../../assets/images/home/arrow-bottom.png'),
    };
  },
  computed:{
    formatListData(){
      return this.listData||[]
    }
  },
  methods: {
    showDetail(item,index){
      this.$set(item,'isShow',!item.isShow)
      item.isShow?$('.more-info').eq(index).slideDown():$('.more-info').eq(index).slideUp()

      // if(this.routerDetail)this.routerDetail(item)
    },
    telTo(tel){
      _g.telTo(tel)
    },
    /**
     * @name 设置收藏
     */
    setCollect(item){
      var params={
        id:item.id,
        type:3
      }
      _g.apiPost('job/jobCollect',params).then(res=>{
        _g.toMessage(res)
        if(!res.error){
          this.$set(item,'collect',!item.collect)
        }
      })
    }
  },
  created() {}
};
</script>
<style lang="scss" scoped>
@import "./list.scss";
</style>